package com.adtech.farmProducts.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.math.BigDecimal;

/**
 * Time:2020/6/22
 * Created by xiaocz
 * Describe 溯源详情
 */
public class SourceInfo implements Parcelable {


    /**
     * handleType : 1
     * sourceCode : 123
     * oldSourceCode : null
     * productName : 123
     * userName : xcz
     * companyName : 亚德
     * weight : 123
     * unit : 千克(kg)
     * packUnit : 箱
     * quantity : 123千克(kg)/箱
     * address : 重庆市
     * handleTime : 2020-06-22 14:10:34
     * imageUrl :
     */

    private int handleType;//1、入库，2、开箱验货，3、标签破损
    private String sourceCode;
    private String oldSourceCode;
    private String productName;
    private String userName;
    private String companyName;
    private int weight;
    private String unit;
    private String packUnit;
    private String quantity;
    private String address;
    private String handleTime;
    private String imageUrl;
    private String productId;

    private int totalNum;
    private BigDecimal totalWeight;

    protected SourceInfo(Parcel in) {
        handleType = in.readInt();
        sourceCode = in.readString();
        oldSourceCode = in.readString();
        productName = in.readString();
        userName = in.readString();
        companyName = in.readString();
        weight = in.readInt();
        unit = in.readString();
        packUnit = in.readString();
        quantity = in.readString();
        address = in.readString();
        handleTime = in.readString();
        imageUrl = in.readString();
        productId = in.readString();
        totalNum = in.readInt();
    }

    public static final Creator<SourceInfo> CREATOR = new Creator<SourceInfo>() {
        @Override
        public SourceInfo createFromParcel(Parcel in) {
            return new SourceInfo(in);
        }

        @Override
        public SourceInfo[] newArray(int size) {
            return new SourceInfo[size];
        }
    };

    /**
     * 1、入库，2、开箱验货，3、标签破损
     * @return
     */
    public int getHandleType() {
        return handleType;
    }

    public void setHandleType(int handleType) {
        this.handleType = handleType;
    }

    public String getSourceCode() {
        return sourceCode;
    }

    public void setSourceCode(String sourceCode) {
        this.sourceCode = sourceCode;
    }

    public String getOldSourceCode() {
        return oldSourceCode;
    }

    public void setOldSourceCode(String oldSourceCode) {
        this.oldSourceCode = oldSourceCode;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getPackUnit() {
        return packUnit;
    }

    public void setPackUnit(String packUnit) {
        this.packUnit = packUnit;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getHandleTime() {
        return handleTime;
    }

    public void setHandleTime(String handleTime) {
        this.handleTime = handleTime;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public int getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(int totalNum) {
        this.totalNum = totalNum;
    }

    public BigDecimal getTotalWeight() {
        return totalWeight;
    }

    public void setTotalWeight(BigDecimal totalWeight) {
        this.totalWeight = totalWeight;
    }

    @Override
    public String toString() {
        return "SourceInfo{" +
                "handleType=" + handleType +
                ", sourceCode='" + sourceCode + '\'' +
                ", oldSourceCode=" + oldSourceCode +
                ", productName='" + productName + '\'' +
                ", userName='" + userName + '\'' +
                ", companyName='" + companyName + '\'' +
                ", weight=" + weight +
                ", unit='" + unit + '\'' +
                ", packUnit='" + packUnit + '\'' +
                ", quantity='" + quantity + '\'' +
                ", address='" + address + '\'' +
                ", handleTime='" + handleTime + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", productId='" + productId + '\'' +
                ", totalNum=" + totalNum +
                ", totalWeight=" + totalWeight +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

        dest.writeInt(handleType);
        dest.writeString(sourceCode);
        dest.writeString(oldSourceCode);
        dest.writeString(productName);
        dest.writeString(userName);
        dest.writeString(companyName);
        dest.writeInt(weight);
        dest.writeString(unit);
        dest.writeString(packUnit);
        dest.writeString(quantity);
        dest.writeString(address);
        dest.writeString(handleTime);
        dest.writeString(imageUrl);
        dest.writeString(productId);
        dest.writeInt(totalNum);
    }
}
